import React, { useState, useRef } from 'react';
import { setting, editsetting } from '@/services/business';
import { connect } from 'umi'
import ProDescriptions from '@ant-design/pro-descriptions';
// type 类型有 table treeselect upload inputnumber datepicker daterange radio select textarea autoinput editor password input 


function First(props) {
    const [state, setstate] = useState({
        id: ""
    });
    const actionRef = useRef();
    let columns = [
        {
            "title": "最低收款金额",
            "dataIndex": "min_payment_price",
            "key": "text"
        },
        {
            "title": "最少开户数量",
            "dataIndex": "min_open_account",
            "key": "money"
        },
        {
            "title": "低于最少开户，每户扣款",
            "dataIndex": "open_account_deduct",
            "key": "money"
        },
        {
            title: '操作',
            valueType: 'option',
            render: () => [
                <a target="_blank" rel="noopener noreferrer" key="link" onClick={() => {
                    props.close()
                }}>
                    返回
                </a>
            ],
        },
    ]



    return (
        <div className="pgcontainer" style={{ padding: 12 }}>
            <ProDescriptions
                actionRef={actionRef}
                bordered
                column={{ xs: 1, sm: 1, md: 2, lg: 3, xl: 4, xxl: 5 }}
                title="最低开单数与收单金额"
                request={async () => {
                    let data = await setting();
                    setstate({
                        id: data.data.id
                    })
                    return setting()
                }}
                editable={{
                    onSave: (key, row, line) => {
                        editsetting({
                            ...row
                        })
                    }
                }}
                columns={columns}
            >
            </ProDescriptions>


        </div>
    )
}

export default connect(({ business, loading }) => ({
    business,
    loading,
}))(First)